import StudentManager from"@/components/StudentManager"
import {Button}from 'antd'
import SearchStudent from "@/components/SearchStudent"
import fetchUsers from '@/util/actions/studentAction';
import Link from 'next/link'


async function UserPage({searchParams}) {
    if(searchParams){
        console.log("searchParams:"+searchParams)
    }
    const q =searchParams?.q||""
    console.log("------"+q)
    const students =await fetchUsers(q)
    console.log("students"+students)
    return (
        <div>
        <div style={{display:'flex',justifyContent:'space-between',marginBottom:'20px'}}>
            <SearchStudent  placeholder={"关键字查询学生"}/>
            <div>
                <Link href="/studentManage/add">
                    <Button>新增学生</Button>
                </Link>
                </div>
                </div>

                <div>
                  <StudentManager students={students}/>
                </div>
        </div>


    )

}
export default UserPage